﻿using BLL.Base;
using CommandService;
using Entity;
using Entity.DbEntity;
using Entity.SysEntity;
using Entity.ViewEntity;
using Entity.ViewEntity.sys;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL.sys
{
    public class ApproveRecordBLL : PubMethod
    {
        Commands cmd;
        LoginInfo userLogin;
        Tools.TxtLogHelper txt;
        ReturnResult rsl;

        public ApproveRecordBLL()
        {
            userLogin = new LoginInfo();
            cmd = new Commands();
        }
        /// <summary>
        /// 版辊信息记录
        /// </summary>
        /// <param name="bussinessType">数据类型</param>
        /// <param name="bussinessCode">外键编码</param>
        /// <returns></returns>
        public ReturnResult BanGunRecords(string bussinessCode,string bussinessType)
        {
            rsl = new ReturnResult();
            StringBuilder sb = new StringBuilder();
            try
            {
                sb.Append("select re.*,d.name resultName,u.userName from sys_Approves_record re ");
                sb.Append("inner join sys_dictionaries_info d on d.code=re.result ");
                sb.Append("inner join sys_users_info u on re.createuser=u.userCode ");
                sb.Append("where businessType='" + bussinessType + "'");
                sb.Append(" and businessCode='" + bussinessCode + "'");
                var table = cmd.GetDataTable(sb.ToString());
                rsl.Result = true;
                rsl.Data = cmd.TableToDictionary(table) ;
            }
            catch (Exception ex)
            {
                rsl.Message = ex.Message;
            }

            return rsl;
        }
    }
}
